<body>
<?php include 'header.phtml';?>

</div>
<div class="AppContent GridView"><div id="MarketingBreadCrumbView" class="BreadCrumbView"><div class="breadcrumbs">
<a href="/ZurmoBajakan/public/marketing/">Marketing</a> &#47; <span>Templates</span></div></div><div id="ActionBarSearchAndListView" class="GridView"><div id="SecuredActionBarForMarketingListsSearchAndListView" class="SecuredActionBarForSearchAndListView ActionBarForSearchAndListView ActionBarConfigurableMetadataView ConfigurableMetadataView MetadataView"><div class="view-toolbar-container clearfix"><nav class="pillbox clearfix"><div id="MarketingDashboardMenuActionElement--yt1" class="default-button">
<a class="button-action" href="<?php echo $this->basePath();?>/marketing/"><i class="icon-marketing-dashboard"></i><span class="button-label">Dashboard</span></a></div><div id="MarketingListsMenuActionElement--yt2" class="split-button">
<a class="button-action" href="<?php echo $this->basePath();?>/marketing/marketing/list"><i class="icon-marketing-lists"></i><span class="button-label">Lists</span></a><a class="button-trigger"><i class="icon-trigger"></i></a><ul class="button-actions"><li><a href="<?php echo $this->basePath();?>/marketing/marketing/createlist">Create List</a></li></ul></div><div class="active split-button" id="EmailTemplatesForMarketingMenuActionElement--yt3">
<a class="button-action" href="<?php echo $this->basePath();?>/marketing/marketing/template"><i class="icon-email-templates"></i><span class="button-label">Templates</span></a><a class="button-trigger"><i class="icon-trigger"></i></a><ul class="button-actions"><li><a href="<?php echo $this->basePath();?>/marketing/marketing/createtemplate">Create Template</a></li></ul></div><div id="CampaignsMenuActionElement--yt4" class="split-button">
<a class="button-action" href="<?php echo $this->basePath();?>/marketing/marketing/campaign"><i class="icon-marketing-campaigns"></i><span class="button-label">Campaigns</span></a><a class="button-trigger"><i class="icon-trigger"></i></a><ul class="button-actions"><li><a href="<?php echo $this->basePath();?>/marketing/marketing/createcampaign">Create Campaign</a></li></ul></div></nav></div></div><div id="EmailTemplatesSearchView" class="SearchView ModelView ConfigurableMetadataView MetadataView"><div class="wide form"><form id="search-form" method="post">
<div style="display:none"><input type="hidden" value="f8ad6475c27bdcde81768d55847a9b1151b34c3e" name="YII_CSRF_TOKEN" /></div><div id="list-view-summary-clone" class="list-view-items-summary-clone"></div><div class="search-view-0" ><table><tr><th></th><td colspan="3"><select class="ignore-style ignore-clearform" id="EmailTemplatesSearchForm_anyMixedAttributesScope" multiple="multiple" style="display:none;" size="4" name="EmailTemplatesSearchForm[anyMixedAttributesScope][]">
<option value="All" selected="selected">All</option>
<option value="name">Name</option>
</select><input class="input-hint anyMixedAttributes-input" onfocus="$(this).select();" size="80" id="EmailTemplatesSearchForm_anyMixedAttributes" name="EmailTemplatesSearchForm[anyMixedAttributes]" type="text" /></td></tr></table></div><div class="search-form-tools"><a id="clear-search-link" style="display:none;" href="#">Clear</a><input id="clearingSearch-search-form" type="hidden" name="clearingSearch" /></div></form><div id="modalContainer-search-form"></div></div></div><div id="EmailTemplatesListView" class="SecuredListView ListView ModelView ConfigurableMetadataView MetadataView"><div class="cgrid-view type-emailTemplates" id="list-view">
<div class="summary">1 result(s)</div><div class="items-wrapper"><table class="items">
<thead>
<tr>
<th class="checkbox-column" id="list-view-rowSelector"><label class="hasCheckBox"><input type="checkbox" value="1" name="list-view-rowSelector_all" id="list-view-rowSelector_all" /></label></th><th id="list-view_c1"><a class="sort-link" href="/zurmo/app/index.php/emailTemplates/default/listForMarketing?EmailTemplate_sort=name">Name</a></th><th id="list-view_c2"><a class="sort-link" href="/zurmo/app/index.php/emailTemplates/default/listForMarketing?EmailTemplate_sort=owner">Owner</a></th><th class="button-column" id="list-view_c3">&#160;</th></tr>
</thead>
<tbody>

<?php 
$con=mysqli_connect("localhost", "root", "", "zurmo");
if (mysqli_connect_errno($con))
{
	echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT emailtemplate.name, person.firstname, person.lastname
FROM emailtemplate, person
") ;

while($row = mysqli_fetch_array($result))
{
	echo "<tr class='odd'>";
	echo "<td class='checkbox-column'><label class='hasCheckBox'><input value='1' id='list-view-rowSelector_0' type='checkbox' name='list-view-rowSelector[]' />"."</td>";
	echo "<td>" . "<a href='/ZurmoBajakan/public/marketing/marketing/templatedetail'>" . $row['name'] . "</td>";
	echo "<td>" . $row['firstname'] . " " . $row['lastname'] . "</td>";
	echo "<td class='button-column'>" . "<a class= 'pencil' title='Update' href='/ZurmoBajakan/public/marketing/marketing/templateedit'>". "!" . "</td>";
	echo "</tr>";
}
echo "</table>";

?>

</tbody>
</table></div><div class="pager vertical"></div><div class="list-preloader"><span class="z-spinner"></span></div><div class="keys" style="display:none" title="/zurmo/app/index.php/emailTemplates/default/listForMarketing"><span>1</span></div>
</div>
<input type="hidden" value="" name="list-view-selectedIds" id="list-view-selectedIds" />
</div></div></div><div id="FlashMessageView"><div id = "FlashMessageBar"></div></div></div><div id="ModalContainerView"><div id="modalContainer"></div></div><div id="ModalGameNotificationContainerView"></div><div id="GameCoinContainerView"></div><div id="FooterView"><a href="http://www.zurmo.com" id="credit-link" class="clearfix"><span>Copyright &#169; Zurmo Inc., 2013. All rights reserved.</span></a><div class="ui-chooser"><a class="icon-mobile" href="/zurmo/app/index.php/zurmo/default/userInterface?userInterface=Mobile"><span>Show Mobile</span></a><a class="icon-desktop active" href="/zurmo/app/index.php/zurmo/default/userInterface?userInterface=Desktop"><span>Show Full</span></a></div></div></div></div></div><script type="text/javascript">
/*<![CDATA[*/
function closeGamificationDashboard(){
                           $('#UserGameDashboardView').remove();
                           $('body').removeClass('gd-dashboard-active');
                           $('#header-game-dashboard-link').html('∂').toggleClass('highlighted');
                       }
jQuery(function($) {

                    jQuery("body").ajaxComplete(
                        function(event, request, options)
                        {
                            if (request.responseText == "sessionTimeout")
                            {
                                $.cookie("sessionTimeoutCookie", 1,
                                        {
                                            expires : 1,
                                            path:  "/"
                                        });
                                window.location.reload(true);
                            }
                        }
                    );
                
$('#go-to-dashboard-link, #close-game-notification-link').click(function(event){
                           event.preventDefault();
                           $('#game-notification').fadeOut(300, function(){
                               $('#game-notification').remove();
                           });
                       });
                       $('.gd-dashboard-active').on('click', function(){
                           if($('#UserGameDashboardView').length){
                               closeGamificationDashboard();
                           }
                           return false;
                       });
$('body').on('click', '#header-game-dashboard-link', function(){jQuery.ajax({'beforeSend':function(){
                    if($("#UserGameDashboardView").length){
                        closeGamificationDashboard();
                        return false;
                    }
                    $("body").addClass("gd-dashboard-active");
                    $("#header-game-dashboard-link").html("‰").toggleClass("highlighted");
                },'success':function(data){$("#FooterView").after(data);},'url':'/zurmo/app/index.php/users/default/gameDashboard?id=1','cache':false});return false;});
  $(".nav li").hover(
    function () {
      if ($(this).hasClass("parent")) {
        $(this).addClass("over");
      }
    },
    function () {
      $(this).removeClass("over");
    }
  );

$("#globalSearchScope").bind("multiselectclick", function(event, ui){
                            if ($("#globalSearchScope").multiselect("widget").find(":checkbox:checked").length == 0)
                            {
                                $("#globalSearchScope").multiselect("widget").find(":checkbox").each(function(){
                                    if (this.value == "All" && !this.checked)
                                    {
                                        this.click();
                                    }
                                });
                            }
                            if (ui.value == "All" && ui.checked)
                            {
                                $("#globalSearchScope").multiselect("widget").find(":checkbox").each(function(){
                                    if (this.value != "All" && this.checked)
                                    {
                                        this.click();
                                    }
                                });
                            }
                            else if (ui.value != "All" && ui.checked)
                            {
                                $("#globalSearchScope").multiselect("widget").find(":checkbox").each(function(){
                                    if (this.value == "All" && this.checked)
                                    {
                                        this.click();
                                    }
                                });
                            }
                        });
                       
$('#globalSearchScope').multiselect({'selectedText':'','noneSelectedText':'','header':false,'position':{'my':'right top','at':'right bottom'}}); $(this).setupCheckboxStyling($('#globalSearchScope').parent())
$("#globalSearchInput").bind("focus", function(event, ui){
                            $("#globalSearchInput").autocomplete("option", "source", "/zurmo/app/index.php/zurmo/default/globalSearchAutoComplete?" + $.param($("#globalSearchScope").serializeArray()));
                        });
                       
jQuery('#globalSearchInput').autocomplete({'select': function(event, ui) {if (ui.item.href.length > 0){window.location = ui.item.href;} return false;},'search': function(event, ui) { $(this).makeOrRemoveTogglableSpinner(true, "#app-search") },'open': function(event, ui) { $(this).makeOrRemoveTogglableSpinner(false, "#app-search") },'position':{'my':'right top','at':'right bottom'},'source':'/zurmo/app/index.php/zurmo/default/globalSearchAutoComplete'});
 $("#globalSearchInput").data( "autocomplete" )._renderItem = function( ul, item ) {
                            return $( "<li></li>" ).data( "item.autocomplete", item )
                                    .append( "<a><span class=" + item.iconClass + "></span><span>" + item.label + "</span></a>" )
                                    .appendTo( ul );
                        };
$('body').on('click', '#yt0', function(){jQuery.ajax({'beforeSend':function(){
                jQuery('#modalContainer').html('');
                $(this).makeLargeLoadingSpinner(true, '#modalContainer');
                window.scrollTo(0, 0);
                jQuery('#modalContainer').dialog({
                    'title' : 'Create Task',
                    'autoOpen' : true,
                    'modal' : true,
                    'position' : 'center top+25',
                    'dialogClass' : 'task-dialog',
                    'height' : 'auto',
                    'open': function( event, ui )  { jQuery('#modalContainer').parent().addClass('openingModal'); },
                    'close': function( event, ui ) { jQuery('#modalContainer').parent().removeClass('openingModal');
                                                     $('#modalContainer').dialog('destroy');
                                                     
                                                     }
                });
                return true;
            },'url':'/zurmo/app/index.php/tasks/default/modalCreate?modalId=modalContainer','cache':false,'success':function(html){jQuery("#modalContainer").html(html)}});return false;});
$("#EmailTemplatesSearchForm_anyMixedAttributesScope").bind("multiselectclick", function(event, ui){
                            if ($("#EmailTemplatesSearchForm_anyMixedAttributesScope").multiselect("widget").find(":checkbox:checked").length == 0)
                            {
                                $("#EmailTemplatesSearchForm_anyMixedAttributesScope").multiselect("widget").find(":checkbox").each(function(){
                                    if (this.value == "All" && !this.checked)
                                    {
                                        this.click();
                                    }
                                });
                            }
                            if (ui.value == "All" && ui.checked)
                            {
                                $("#EmailTemplatesSearchForm_anyMixedAttributesScope").multiselect("widget").find(":checkbox").each(function(){
                                    if (this.value != "All" && this.checked)
                                    {
                                        this.click();
                                    }
                                });
                            }
                            else if (ui.value != "All" && ui.checked)
                            {
                                $("#EmailTemplatesSearchForm_anyMixedAttributesScope").multiselect("widget").find(":checkbox").each(function(){
                                    if (this.value == "All" && this.checked)
                                    {
                                        this.click();
                                    }
                                });
                            }
                        });
                       
$('#EmailTemplatesSearchForm_anyMixedAttributesScope').multiselect({'selectedText':'','noneSelectedText':'','header':false}); $(this).setupCheckboxStyling($('#EmailTemplatesSearchForm_anyMixedAttributesScope').parent())
 basicSearchQueued = 0; basicSearchOldValue = '';   var basicSearchHandler = function(event)
                            {
                                if (basicSearchOldValue != $(this).val())
                                {
                                    basicSearchOldValue = $(this).val();
                                    basicSearchQueued = basicSearchQueued  + 1;
                                    setTimeout('basicSearchQueued = basicSearchQueued - 1', 900);
                                    setTimeout('$(this).searchByQueuedSearch("EmailTemplatesSearchForm_anyMixedAttributes")', 1000);
                                }
                            };   $('#EmailTemplatesSearchForm_anyMixedAttributes').unbind('input.ajax propertychange.ajax keyup.ajax');
                                $('#EmailTemplatesSearchForm_anyMixedAttributes').bind('input.ajax propertychange.ajax keyup.ajax', basicSearchHandler);
                            

                $('#clear-search-link').removeAttr('clearForm');
                $('#clear-search-link').clearform({
                        form: '#search-form'
                    }
                );
                $('#clear-search-link').unbind('click.clear');
                $('#clear-search-link').bind('click.clear', function(){
                        $('#clearingSearch-search-form').val('1');
                        $('#clear-search-link').hide();
                        
                        $(this).closest('form').submit();
                        $('#clearingSearch-search-form').val('');
                        return false;
                    }
                );
                $('#more-search-link').unbind('click.more');
                $('#more-search-link').bind('click.more',  function(event){
                        $('.select-list-attributes-view').hide();
                        $('.kanban-board-options-view').hide();
                        $(this).closest('form').find('.search-view-1').toggle();
                        return false;
                    }
                );
                $('#cancel-advanced-search').unbind('click');
                $('#cancel-advanced-search').live('click', function(event){
                    $(this).closest('form').find('.search-view-1').hide();
                });
            
                $('#search-form').find('.anyMixedAttributes-input').unbind('input.clear propertychange.clear keyup.clear');
                $('#search-form').find('.anyMixedAttributes-input').bind('input.clear propertychange.clear keyup.clear', function(event)
                {
                    $('#clear-search-link').show();
                });
            

                $('#search-form').unbind('submit');
                $('#search-form').bind('submit', function(event)
                    {
                        $(this).closest('form').find('.search-view-1').hide();
                        
                var empty = $('#search-form').find('.anyMixedAttributes-input').val() == '';
                $(this).closest('form').find('.search-view-1').find(':input').each(function()
                {
                    if ($(this).val() != '')
                    {
                        empty = false;
                    }
                });
                if (!empty)
                {
                    $('#clear-search-link').show();
                }
                else
                {
                    $('#clear-search-link').hide();
                }
            
                        $('.select-list-attributes-view').hide();
                        $('.kanban-board-options-view').hide();
                        $('#list-view-selectedIds').val(null);
                        $.fn.yiiGridView.update('list-view',
                        {
                            data: $(this).serialize() + '&EmailTemplate_page=&EmailTemplate_sort=' // Not Coding Standard
                         }
                        );
                        return false;
                    }
                );
jQuery('#list-view-rowSelector_all').live('click', function()
{
    var checked = this.checked;

    //custom checkbox style
    if (this.checked){
        jQuery(this).parent().addClass('c_on');
    }
    else
    {
        jQuery(this).parent().removeClass('c_on');
    }

    jQuery("input[name='list-view-rowSelector\[\]']").each(function()
    {
        this.checked = checked;
        updateListViewSelectedIds('list-view', $(this).val(), checked);

        //custom checkbox style
        if (this.checked){
            jQuery(this).parent().addClass('c_on');
        }
        else
        {
            jQuery(this).parent().removeClass('c_on');
        }
    });
});
jQuery("input[name='list-view-rowSelector\[\]']").live('click', function()
{
    jQuery('#list-view-rowSelector_all').attr( 'checked', jQuery("input[name='list-view-rowSelector\[\]']").length == jQuery("input[name='list-view-rowSelector\[\]']:checked").length);
    updateListViewSelectedIds('list-view', $(this).val(), $(this).attr('checked'));

    //custom checkbox style
    if ( jQuery('#list-view-rowSelector_all').attr( 'checked') === 'checked' ){
        jQuery('#list-view-rowSelector_all').parent().addClass('c_on');
    }
    else
    {
        jQuery('#list-view-rowSelector_all').parent().removeClass('c_on');
    }
    if ( this.checked )
    {
        jQuery(this).parent().addClass('c_on');
    }
    else
    {
        jQuery(this).parent().removeClass('c_on');
    }
});
jQuery('#list-view').yiiGridView({'ajaxUpdate':['list-view'],'ajaxVar':'ajax','pagerClass':'pager vertical','loadingClass':'loading','filterClass':'filters','tableClass':'items','selectableRows':2,'enableHistory':false,'updateSelector':'{page}, {sort}','filterSelector':'{filter}','pageVar':'EmailTemplate_page','beforeAjaxUpdate':function(id, options) { $(this).makeSmallLoadingSpinner(true, "#" + id); addListViewSelectedIdsToUrl(id, options); },'afterAjaxUpdate':function(id, data) {
                        processAjaxSuccessError(id, data);
                        var $data = $(data);
                        jQuery.globalEval($data.filter("script").last().text());
                    }});

                processListViewSummaryClone("list-view", "summary", "list-view-summary-clone");
            
});
/*]]>*/
</script>
</body>